#pragma once
#include "MenuState.h"
#include "Entity.h"
#include "Avatar.h"
//#include "../SGD Wrappers/CSGD_ObjectFactory.h"
#include <vector>
using namespace std;
#include "Emitter.h"
//typedef CSGD_ObjectFactory< TSTRING, CEntity > CSGD_Factory;

class CSGD_Direct3D;
class CSGD_DirectInput;
class CSGD_TextureManager;
class CSGD_XAudio2;

class IMessage;

class CAnimationManager;
class CAnimationInfo;
class CElemental;
class CObjectManager;
class CObjectFactory;
class CMessageSystem;
class CLanes;
class CWaypoint;
class CPlayer;
class CAnimation;
class CFrame;

class CTileSystem;

class CGameplayState :
	public MenuState
{
public:
	static CGameplayState* GetInstance(void);

	virtual void Enter( void );
	virtual void Exit( void );
	virtual bool Input(void);
	virtual void Update(float fElapsedTime);
	virtual void Render(void);

	void SetAmountofLanes(unsigned int number);

	static void MessageProc( IMessage* pMsg );

	vector<CWaypoint*> LanePath( short laneNumber );

	vector<CElemental*> GetElementalLane( short index );

	CEntity* CheckForTargets( CEntity* CheckThis );

	void AddElementalToLane( CElemental* goon, short laneNum );

private:
	CGameplayState(void);
	virtual ~CGameplayState(void);
	CGameplayState& operator=( const CGameplayState& );
	CGameplayState( const CGameplayState& );

	
	int						BackgroundMusicID;
	int						tempImg;
	int						BackgroundImgID;

	vector<vector<CWaypoint*>> m_vLanes;
	vector<vector<CElemental*>> m_vElementalsInALane;

	CTileSystem*			m_pTS;
	CSGD_Direct3D*			m_pD3D;
	CSGD_DirectInput*		m_pDI;
	CSGD_TextureManager*	m_pTM;
	CSGD_XAudio2*			m_pXA;
	//CBitmapFont*			m_pBF;

	CObjectManager*			m_pOM;
	CObjectFactory*			m_pOF;
	CMessageSystem*			m_pMS;
	//Animation*			m_pAN;
	CAnimationManager*		m_pAnimationManager;
	CAnimationInfo*			m_pAnimationInfo;
	CAnimation*				m_pAnimation;
	CFrame*					m_pFrame;

	CAvatar*				tempAvatar;
	
	CPlayer*				Player1;
	CPlayer*				Player2;

	unsigned int			m_unFrames;
	float					m_fFPSTimer;
	unsigned int			m_unFPS;
	bool					m_bPaused;
	bool					m_bGameOver;

	Emitter emitter;

};

